package com.bitcola.security.activity.controller;

import com.bitcola.security.activity.biz.DefiMiningBiz;
import com.bitcola.security.activity.mapper.BalanceMapper;
import com.bitcola.security.auth.client.annotation.IgnoreUserToken;
import com.bitcola.security.common.context.BaseContextHandler;
import com.bitcola.security.common.msg.AppResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("dexMining")
public class DexMiningController {
    @Autowired
    DefiMiningBiz defiMiningBiz;



    @RequestMapping(value = "query")

    public AppResponse query()
    {
        String userId= BaseContextHandler.getUserID();
        return AppResponse.ok().data(defiMiningBiz.getList(userId));


    }
    @RequestMapping(value = "getDailyProfit")
    public AppResponse getDailyProfit(String coinCode)
    {
        String userId= BaseContextHandler.getUserID();
        return AppResponse.ok().data(defiMiningBiz.getDailyProfit(userId,coinCode));

    }
    @RequestMapping(value = "getMiningLong")

    public AppResponse getMiningLong(int page,int size)
    {
        String userId= BaseContextHandler.getUserID();
        return AppResponse.ok().data(defiMiningBiz.getDexminingLogs(userId,page,size));

    }
    @RequestMapping(value = "getCoinProfit")
    public AppResponse getCoinProfit(String coinCode)
    {
        String userId= BaseContextHandler.getUserID();
        return AppResponse.ok().data(defiMiningBiz.getProfit(userId,coinCode));

    }
    @RequestMapping(value = "getWorks")
    public AppResponse getWorks(String coinCode)
    {
        return AppResponse.ok().data(defiMiningBiz.getMiningActor(BaseContextHandler.getUserID(),coinCode));

    }
    @RequestMapping(value = "shareMining")
    @IgnoreUserToken

    public String shareMining()
    {
        defiMiningBiz.shareMining();
        return "ok";

    }
    @RequestMapping(value = "holdMining")
    @IgnoreUserToken

    public String holdMining()
    {
        defiMiningBiz.miningHold();
        return "ok";

    }
    @RequestMapping(value = "getMiningNum")
    @IgnoreUserToken

    public Map getMiningNum()
    {
        return DefiMiningBiz.miningNumMap;

    }
}
